<template>
	<view class="wrap">
		<view class="main-page">
			<view class="list-wrap" @click="enterpage(item)" v-for="(item,index) in pList" :key="index">
				<view class="left">
					<image src="../../static/newlog.png" mode=""></image>
				</view>
				<view class="right">
					<view class="top">
						<view class="desc">
							{{item.title}}
							

						</view>
						<view class="timer">
							{{item.create_time}}
						</view>
						
					</view>
					<view class="bottom" >
						 <rich-text :nodes="item.details2"></rich-text>
					</view>
				</view>
			</view>
		</view>
		<uni-load-more  :status="more">
		</uni-load-more>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				nowpage:1,
				more:'loading',
				title: 'Hello',
				pList:[]
			}
		},
		
		onReachBottom() {
			if(this.more=='nomore'){
				return
			}
			this.getData()	
		},
		onLoad() {
			this.getData()
		},
		methods: {
			getData(){
				let that=this
				that.apipost('/api/home/announce_list',{
					page:that.nowpage,
					
				},true).then(res => {
					if(res.Code==10200){
						
						let data=res.Data
						that.pList=that.pList.concat(data)
						++that.nowpage
						uni.stopPullDownRefresh()
						if(data.length<15){
							that.more='nomore'
						}
						that.pList=data.map(
							item=>{
								item.details2=item.details.replace(/<[^<>]+>/g,'')
								return item
							}
						)
					}
					
				}).catch(err=>{
					console.log(err)
				});
			},
			enterpage(item){
				uni.navigateTo({
				    url: `../gonggaodetail/index?id=${item.id}`
				});
			}
		}
	}
</script>

<style>
	.timer{
		color:#a9a9a9;
	}
	.list-wrap .top{
		display:flex;
		padding-bottom:30rpx;
		justify-content: space-between;
		align-items: center;
	}
	.list-wrap .top .desc{
		width:320rpx;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}
	.list-wrap .bottom *{
		color:#ababab;
		width:460rpx;
		text-overflow: ellipsis;
		white-space:nowrap;
		overflow: hidden;
		
	}
	.list-wrap{
		padding-top:32rpx;
		padding-bottom:22rpx;
		border-bottom:1rpx solid #e8e8e8;
	}
	.list-wrap .left{
		height:126rpx;
		margin-right:22rpx;
		width:126rpx;
		border-radius:50%;
	}
	.list-wrap uni-image{
		height:126rpx;
		
		width:126rpx;
		
	}
	.list-wrap .right{
		flex:1
	}
	.list-wrap{
		display:flex;
		align-items: center;
		justify-content: space-between;
	}
	.main-page{
		width:666rpx;
		margin:0 auto;
	}
	page{
		border-top:1rpx solid #e8e8e8;
	}
</style>
